package com.lxz.bookmanager.controller.admin;

import com.lxz.bookmanager.mapper.ReaderMapper;
import com.lxz.bookmanager.entity.Reader;
import com.lxz.bookmanager.service.ReaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/admin/reader")
public class AdminReaderController {

    @Autowired
    private ReaderService readerService;

    @RequestMapping("/getAll")
    public String getAll(Model model) {
        List<Reader> readers = readerService.getAllReader();
        model.addAttribute("readers", readers);
        return "admin/readers";
    }
}
